package indi.gao.springAopTest.controller;

import indi.gao.springAopTest.dao.ScoreDao;
import indi.gao.springAopTest.dto.ScoreDto;
import indi.gao.springAopTest.model.Student;
import indi.gao.springAopTest.service.student.StudentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>Description:</p>
 * <p>Copyright: Copyright (c)2020$</p>
 * <p>Company: Tope</p>
 * <P>Created Date :2020$-05$-18$</P>
 * <P>@version 1.0</P>
 */
@RestController
public class ScoreController {

    @Resource
    private ScoreDao scoreDao;

    @Resource
    private StudentService studentService;

    @RequestMapping(value = "/testScore/{all}")
    public List<ScoreDto> listAllBook(@PathVariable Boolean all) {
        return scoreDao.getScoreDtos(1l);
    }

    @RequestMapping(value = "insertStudent")
    public Student insertStudent() {
        Student student = new Student();
        try {
            student.setStudentName("高雷");
            studentService.insertStudent(student);
        } catch (Exception ignored) {

        }
        return student;
    }
}
